package com.qianya.system.face.util;

import com.qianya.system.face.config.RedisUtil;
import com.qianya.system.face.web.patient.model.PatientFileInfo;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author lhl
 * @date 2020/3/13 16:34
 */
public class UserRamCache {
    /**
     * @desc 获得人脸库更新
     * @author lhl
     * @date 2020-07-01 16:52
     * @return
     */
    public static void addUser(PatientFileInfo fileInfo) {
        Map<String,Object> map=new HashMap<>();
        map.put(fileInfo.getFileId(),fileInfo);
        RedisUtil.hset("fileInfo",map);
    }


    /**
     * @desc 获得人脸库
     * @author lhl
     * @date 2020-07-01 16:52
     * @return
    */
    public static List<PatientFileInfo> getUserList() {
        Map<String,PatientFileInfo> map=(Map<String,PatientFileInfo>)RedisUtil.hget("fileInfo","");
        List<PatientFileInfo> list=new ArrayList<PatientFileInfo>();
        for (PatientFileInfo value : map.values()) {
            list.add(value);
        }
        return list;
    }

}
